package com.itheima;

import com.itheima.service.UserService;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class App {
    public static void main(String[] args) {
        AnnotationConfigApplicationContext ctx =
                new AnnotationConfigApplicationContext(Application.class);
        System.out.println("=================");
        UserService userService = (UserService) ctx.getBean("userService");
        userService.save();

        ctx.close();
    }

    public static void main2(String[] args) {
        AnnotationConfigApplicationContext ctx =
                new AnnotationConfigApplicationContext(Application.class, Application2.class);
        System.out.println("=================");

        ctx.close();
    }

    public static void main1(String[] args) {
        ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("aaa.tmp-applicationxml");

        UserService userService = (UserService) ctx.getBean("userService");
        userService.save();

        ctx.close();

    }
}
